package com.huawei;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Description: HJ17 坐标移动
 * 开发一个坐标计算工具， A表示向左移动，D表示向右移动，W表示向上移动，S表示向下移动。从（0,0）点开始移动，从输入字符串里面读取一些坐标，并将最终输入结果输出到输出文件里面。
 *
 * @author weiruibai.vendor
 * Date: 2022/8/15 16:42
 */
public class HJ17 {

    private static final Character LEFT = 'A';
    private static final Character RIGHT = 'D';
    private static final Character UP = 'W';
    private static final Character DOWN = 'S';

    /**
     * 输入：
     * A10;S20;W10;D30;X;A1A;B10A11;;A10;
     * 复制
     * 输出：
     * 10,-10
     *
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int row = 0;
        int col = 0;
        List<Character> list = new ArrayList<Character>() {{
            add('A');
            add('D');
            add('W');
            add('S');
        }};
        String str = reader.readLine();
        String[] strs = str.split(";");
        for (int i = 0; i < strs.length; i++) {
            String s = strs[i];
            if (s == null || s == "") {
                continue;
            }
            try {
                Character opFlag = s.charAt(0);
                if (!list.contains(opFlag)) {
                    //System.out.println("无效");
                    continue;
                }
                int num = 0;
                try {
                    num = Integer.parseInt(s.substring(1));
                } catch (Exception e) {
                    //System.out.println(s + "无效");
                }
                if (LEFT.equals(opFlag)) {
                    row-= num;
                } else if (RIGHT.equals(opFlag)) {
                    row += num;
                } else if (UP.equals(opFlag)) {
                    col += num;
                } else {
                    // down
                    col -= num;
                }
            } catch (Exception e) {
                //System.out.println("无效");
            }

        }
        System.out.println(row + "," + col);
    }


}
